home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ham Radio 2000 #2
/
Ham Radio 2000 - Volume 2.iso
/
HAMV2
/
PACKET
/
APRS805
/
MKMAPLST.BAS
< prev
next >
Wrap
BASIC Source File
|
1995-02-05
|
3KB
|
81 lines
CLS
PRINT "This program will search through a given directory for all .MAP files and"
PRINT "will build a TEXT file in the necessary MAPLIST.xx format."
PRINT
PRINT "The maps will be sorted by size within each state, but the order will"
PRINT "in NO WAY be the proper heirarchical order!"
PRINT
PRINT "but the text file can be used with an editor to build a proper MAPLIST.xx"
PRINT "file. "
PRINT
x = 200
DIM MpNm$(x), LAcn(x), LOcn(x), Rng(x)
MAPpath$ = "\APRS\MAPS"
PRINT "Enter path to the directory to scan if not "; MAPpath$;
INPUT a$: IF a$ <> "" THEN MAPpath$ = a$
PRINT "Enter name of output text file if not MAPCENS.txt";
INPUT a$: IF a$ <> "" THEN OUTFILE$ = a$ ELSE OUTFILE$ = "MAPCENS.txt"
SHELL "dir " + MAPpath$ + " >temp.txt"
OPEN "temp.txt" FOR INPUT AS #1
OPEN OUTFILE$ FOR OUTPUT AS #3
DO UNTIL EOF(1)
LINE INPUT #1, a$: REM PRINT a$
IF LEN(a$) > 38 AND LEFT$(a$, 1) <> "." AND LEFT$(a$, 1) <> " " THEN
MpNm$ = LEFT$(a$, 8) + "." + MID$(a$, 10, 3)
IF RIGHT$(MpNm$, 3) = "MAP" THEN
nmp = nmp + 1
MpNm$(nmp) = MpNm$
PRINT "Opening "; MpNm$(nmp)
OPEN MAPpath$ + "\" + MpNm$(nmp) FOR INPUT AS #2
FOR i = 1 TO 3: LINE INPUT #2, a$: NEXT i
INPUT #2, LAcn(nmp): LINE INPUT #2, a$
INPUT #2, LOcn(nmp): LINE INPUT #2, a$
INPUT #2, Rng(nmp): LINE INPUT #2, a$
CLOSE #2 ' Finished all of that file
END IF
END IF 'if it was a valid file name
LOOP 'to the next MAP file
CLOSE #1 ' Finished that all files in that directory
Sort: 'First by size and then by state
FOR i = 1 TO nmp
FOR j = i TO nmp
IF Rng(i) < Rng(j) THEN
Temp$ = MpNm$(j): LA = LAcn(j): LO = LOcn(j): RA = Rng(j)
MpNm$(j) = MpNm$(i): LAcn(j) = LAcn(i): LOcn(j) = LOcn(i): Rng(j) = Rng(i)
MpNm$(i) = Temp$: LAcn(i) = LA: LOcn(i) = LO: Rng(i) = RA
END IF
NEXT j
NEXT i
FOR i = 1 TO nmp
FOR j = i TO nmp
IF LEFT$(MpNm$(i), 2) > LEFT$(MpNm$(j), 2) THEN
Temp$ = MpNm$(j): LA = LAcn(j): LO = LOcn(j): RA = Rng(j)
MpNm$(j) = MpNm$(i): LAcn(j) = LAcn(i): LOcn(j) = LOcn(i): Rng(j) = Rng(i)
MpNm$(i) = Temp$: LAcn(i) = LA: LOcn(i) = LO: Rng(i) = RA
END IF
NEXT j
NEXT i
Writeout:
FOR i = 1 TO nmp
PRINT #3, MpNm$(i); ","; LAcn(i); ","; LOcn(i); ","; Rng(i); ","
NEXT
CLOSE #3
PRINT : PRINT "DONE!"
STOP
END